package org.uim.cricket.updater.fetch.impl;

import org.uim.cricket.updater.fetch.URLGeneratable;

public class CricInfoMatchURLGenerator implements URLGeneratable {

	private String baseURL = "http://www.espncricinfo.com";
	
	@Override
	public String generateURL(String[] args) {
		StringBuilder url = new StringBuilder();
		if (args == null || args.length == 0) return null;
		
		url.append(this.baseURL);
		if (!this.baseURL.endsWith("/") && !args[0].startsWith("/")) {
			url.append("/");
		}
		url.append(args[0]);
		
		return url.toString();
	}
	
	public void setBaseURL(String baseURL) {
		this.baseURL = baseURL;
	}
	
	public String getBaseURL() {
		return baseURL;
	}

}
